using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Jogo_Grupo2.Cenas;
using Jogo_Grupo2.Telas;

namespace Jogo_Grupo2
{
    
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        public GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        SpriteFont sfont;
        
        public static Game1 instancia;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //graphics.PreferredBackBufferHeight = 900;
             graphics.PreferredBackBufferWidth = 950;
            instancia = this;
        }

        protected override void Initialize()
        {
            GerenciadorDeCenas.setarcena(new Menu());

            base.Initialize();
        }

        
        protected override void LoadContent()
        {            
            spriteBatch = new SpriteBatch(GraphicsDevice);            
        }

        
        protected override void UnloadContent()
        {
            
        }
                
        protected override void Update(GameTime gameTime)
        {
            
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            Cenas.GerenciadorDeCenas.update(gameTime);
                                   

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            
            spriteBatch.Begin();
            Cenas.GerenciadorDeCenas.draw(spriteBatch);



            //spriteBatch.DrawString(sfont, "Tecle ESC para sair", new Vector2(50, 800), Color.Orange);
            
            spriteBatch.End();
            
            base.Draw(gameTime);
        }
    }
}
